﻿using System;
using System.Windows.Forms;
using MentalAlchemy.Molecules.MachineLearning;

namespace MentalAlchemy.Compounds.MachineLearning
{
	public partial class EAPropertiesControl : UserControl
	{
		#region - Public properties. -
		/// <summary>
		/// Returns newly created EA parameters using values from the controls setting.
		/// Note that RNG is initialized during this property reading thus it may be undesirable to use it without real necessity.
		/// </summary>
		public EAParameters Parameters
		{
			get
			{
				var eaparams = new EAParameters();
				eaparams.GenerationsNumber = (int)GenerationsNumeric.Value;
				eaparams.PopulationSize = (int)PopSizeNumeric.Value;
				eaparams.TournamentSize = (int)TourSizeNumeric.Value;
				eaparams.ParentsNumber = (int)ParentsNumeric.Value;
				eaparams.OffspringNumber = (int)ChildrenNumeric.Value;
				eaparams.MRate = (float)MRateNumeric.Value;
				eaparams.XRate = (float)XRateNumeric.Value;
				eaparams.RNG = new Random();
				eaparams.MinGeneValue = -1.0f;
				eaparams.GeneValueRange = 2.0f;

				return eaparams;
			}
		}
		#endregion

		#region - Constructor. -
		public EAPropertiesControl()
		{
			InitializeComponent();
		} 
		#endregion
	}
}
